#include <stdio.h>

// sprintf 函数 和 sscanf 函数

int main(){

    int age = 18;
    double score = 65.5;
    char name[] = "tom";
    char outputString[100];

    sprintf(outputString, "我叫%s,今年%d岁,成绩%.2f分", name, age, score);
    printf("%s\n", outputString);

    char inputString[] = "tom成绩:60.5,jerry成绩:66.5,kitty成绩:89";
    float score1, score2, score3;
    sscanf(inputString, "tom成绩:%f,jerry成绩:%f,kitty成绩:%f", &score1, &score2, &score3);

    printf("score1=%.2f, score2=%.2f, score3=%.2f\n", score1, score2, score3);

    return 0;
}